package pl.grabar.clinic.core.domain.person.data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import pl.grabar.clinic.core.domain.visit.Visit;

/**
 * Klasa reprazentuje karte pacjęta
 * 
 * @author db
 * 
 */
@Entity
@Table(name = "PATIENT_RECORD")
public class PatientRecord implements Serializable {

	private static final long serialVersionUID = 1880981357765553617L;

	@Id
	@GeneratedValue
	private long id;

	@OneToMany(mappedBy = "patient", fetch = FetchType.EAGER, cascade = { CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH })
//	@JoinColumn(name = "PATIENT_ID_IN_RECORD")
	private List<Visit> visits;

	public PatientRecord() {
		this.visits = new ArrayList<>();
	}
	
	/* AKCESORY */

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public List<Visit> getVisits() {
		return visits;
	}

	public void setVisits(List<Visit> visits) {
		this.visits = visits;
	}

}
